<template>
  <header class="header-container">
    <div class="header-content">
      <div class="logo-area">
        <h1 class="site-title">医疗设备全周期管理系统-信息门户</h1>
      </div>
      
      <!-- <nav class="nav-tabs">
        <router-link 
          v-for="tab in tabs"
          :key="tab.path"
          :to="tab.path"
          active-class="active"
          class="tab-item"
        >
          {{ tab.name }}
        </router-link>
      </nav> -->
      
      <!-- <div class="action-area">
        <el-dropdown trigger="click">
          <span class="settings-btn">
            <i class="el-icon-setting"></i>
            <span class="settings-tooltip">系统设置</span>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>个人设置</el-dropdown-item>
            <el-dropdown-item>系统偏好</el-dropdown-item>
            <el-dropdown-item divided @click="logout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div> -->
    </div>
  </header>
</template>

<script setup>
import { ref, computed } from 'vue'
import { storeToRefs } from 'pinia'
import { useTokenStore } from '@/stores/token' 
// 获取 store 实例
const userStore = useTokenStore()

const tabs = ref([{ name: '首页', path: '/' }])

const logout = () => {
  userStore.logout()
  window.location.href = '/login.html'
}
</script>

<style scoped>
.header-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #42b983; 
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo-area {
  flex: 0 0 220px;
}

.site-title {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  color: white;
}

.nav-tabs {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.tab-item {
  color: #b0bec5;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.tab-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.tab-item.active {
  color: #fff;
  background: #1890ff;
  font-weight: 500;
}

.action-area {
  flex: 0 0 220px;
  display: flex;
  justify-content: flex-end;
}

.settings-btn {
  display: flex;
  align-items: center;
  position: relative;
  color: #b0bec5;
  text-decoration: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s;
}

.settings-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.settings-btn i {
  font-size: 18px;
}

.settings-tooltip {
  margin-left: 6px;
  font-size: 14px;
}
</style>